package com.heraleign.ws.client;

import com.heraleign.ws.HelloService;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;

public class CXFClient01 {
    public static void main(String[] args) {
        // 1、设置代理工厂
        JaxWsProxyFactoryBean factory= new JaxWsProxyFactoryBean();

        // 2、设置远程服务地址
        factory.setAddress("http://localhost:8081/ws/hello");

        // 3、设置接口类型
        factory.setServiceClass(HelloService.class);

        // 4、对接口生成代理对象
        HelloService helloService = factory.create(HelloService.class);

        // 5、远程访问服务端方法
        String result = helloService.sayHello("luoyw");

        System.out.println(result);


    }
}
